package com.igeek;

import com.igeek.domain.User;
import com.igeek.service.UserServiceImpl;
import com.igeek.service.UserServiceImpl1;
import com.igeek.service.UserServiceImpl2;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Demo {
    @Test
    public void t1(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserServiceImpl userServiceImpl = (UserServiceImpl) ac.getBean("userServiceImpl");
        userServiceImpl.save();
    }
    @Test
    public void t2(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserServiceImpl1 userServiceImpl1 = (UserServiceImpl1) ac.getBean("userServiceImpl1");
        userServiceImpl1.save();
    }
    @Test
    public void t3(){
        ApplicationContext ac=new ClassPathXmlApplicationContext("applicationContext.xml");
        User user= (User) ac.getBean("user");
        System.out.println(user);
    }
    @Test
    public void t4(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserServiceImpl2 userServiceImpl2 = (UserServiceImpl2) ac.getBean("userServiceImpl2");
        userServiceImpl2.save();
    }

}
